package com.zx.zxojbackendjudge.codesandbox;


import com.zx.zxojbackendmodel.dto.judge.ExecuteCodeRequest;
import com.zx.zxojbackendmodel.dto.judge.ExecuteCodeResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * 代码沙箱代理类
 */
@Slf4j
public class CodeSandBoxProxy implements CodeSandBox{
    //代码沙箱示例
    private CodeSandBox codeSandBox;
    public CodeSandBoxProxy(CodeSandBox codeSandBox){
        this.codeSandBox = codeSandBox;
    }

    /**
     * 代理执行代码
     * @param executeCodeRequest
     * @return
     */
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest){
        log.info("代码沙箱请求信息：" + executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandBox.executeCode(executeCodeRequest);
        log.info("代码沙箱响应信息：" + executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
